

package com.hazelcast.test;

/**
 * Interface of classes that hold progress information of asserted conditions
 * in tests. Instances of this interface are meant to be created at each
 * iteration of eventual completion checks.
 *
 * @see ProgressCheckerTask
 * @see HazelcastTestSupport#assertCompletesEventually(ProgressCheckerTask, long)
 */
public interface TaskProgress {

    /**
     * Tells whether the checked task completed or not
     *
     * @return {@code true} if the task completed, {@code false} otherwise
     */
    boolean isCompleted();

    /**
     * Returns the current progress as a fractional number between 0 and 1.
     *
     * @return the progress
     */
    double progress();

    /**
     * Returns the timestamp when this progress snapshot was taken
     *
     * @return the timestamp of the progress snapshot
     */
    long timestamp();

    /**
     * Returns a formatted progress string with the available information.
     * Called when the available time for the task to complete exceeded.
     *
     * @return the formatted progress string
     */
    String getProgressString();
}
